/*
    SUSAN® - Sole of Unix Save ANything

   Copyright (C) 2020-2020 Hechzh Property

   
*/

#ifndef BAREOS_SRC_DIRD_DBCOPY_DATABASE_IMPORT_MYSQL_H_
#define BAREOS_SRC_DIRD_DBCOPY_DATABASE_IMPORT_MYSQL_H_

#include "include/bareos.h"
#include "dird/dbcopy/database_import.h"

class BareosDb;
class DatabaseConnection;
class DatabaseExport;
class DatabaseTableDescriptions;
struct ResultHandlerContext;
class Progress;

class DatabaseImportMysql : public DatabaseImport {
 public:
  DatabaseImportMysql(const DatabaseConnection& db_connection,
                      std::size_t maximum_amount_of_rows);

  void ExportTo(DatabaseExport& exporter) override;

 private:
  static int ResultHandlerCopy(void* ctx, int fields, char** row);
  static void FillRowWithDatabaseResult(ResultHandlerContext* r,
                                        int fields,
                                        char** row);

  void RunQuerySelectAllRows(DB_RESULT_HANDLER* ResultHandler,
                             DatabaseExport& exporter);
  std::size_t limit_amount_of_rows_{};
};


#endif  // BAREOS_SRC_DIRD_DBCOPY_DATABASE_IMPORT_MYSQL_H_
